<template>
  <el-form :rules="rules" :model="form">
    <el-form-item :label="'物流公司'" prop="logisticalCompany">
      <x-select
        placeholder="请选择物流公司"
        v-model="form.logisticalCompany"
        :options="dictOptions['srm_delivery_note.logistical_company']"
        style="width: 100%"
      ></x-select>
    </el-form-item>
    <el-form-item :label="'物流单号'" prop="logisticalNumber">
      <el-input
        placeholder="请输入物流单号"
        v-model="form.logisticalNumber"
        style="width: 100%"
        maxlength="100"
        clearable
      />
    </el-form-item>
    <el-form-item :label="'文件说明'">
      <el-input
        placeholder="请输入文件说明"
        v-model="form.remark"
        type="textarea"
        style="width: 100%"
        maxlength="50"
        show-word-limit
        rows="4"
        clearable
      />
    </el-form-item>
  </el-form>
</template>

<script>
  import { QueryDictMixin } from '@package/utils'

  export default {
    name: 'ReturnForm',
    mixins: [QueryDictMixin],
    props: {
      id: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        form: {
          contractId: '',
          // type: 'reply', // mail是供应商给企业 reply是企业给供应商
          logisticalCompany: '',
          logisticalNumber: '',
          remark: ''
        },
        rules: {
          logisticalCompany: [{ required: true, message: '请选择物流公司', trigger: 'blur' }],
          logisticalNumber: [{ required: true, message: '请输入物流单号', trigger: 'blur' }]
        },
        srmDictKeys: ['srm_delivery_note.logistical_company']
      }
    },
    watch: {
      id: {
        handler(val) {
          if (val) {
            this.form.contractId = val
          }
        },
        immediate: true
      }
    },
    created() {
      this.initDictConfig()
    },
    methods: {
      resetForm() {
        this.form.logisticalCompany = ''
        this.form.logisticalNumber = ''
        this.form.remark = ''
      }
    }
  }
</script>

<style scoped></style>
